<template>
  <div>
        <p>
          <textarea  :placeholder="str" v-model="content"></textarea>
          <button @click="send_comment">提交评论</button>
      </p>
  </div>
</template>
<script>
import axios from 'axios'
export default {
    data(){
        return{
            ding:[],
            goods:[],
            users:[],
            uid: sessionStorage.getItem('uid'),
            ding_infos:[],
            can_comment :0,
            str:'',
            content : '',
            gid:this.$route.query.gid,
            did:this.$route.query.did,
        }
    },
    methods:{
        send_comment(){
            var formdata= new FormData
            formdata.append('uid',sessionStorage.getItem('uid'))
            formdata.append('gid',this.gid)
            formdata.append('content',this.content)
            formdata.append('did',this.did)

            axios.post('http://127.0.0.1:8000/myapp/inser_comment/',formdata).then(res=>{
                console.log(res.data)
                if(res.data.code==200){
                    window.location.href='/show_ding'
                }
            })
        }
    }
}
</script>

<style>

</style>